package com.yunxi.service.dubboService.impl.sto;

import com.github.pagehelper.PageInfo;
import com.yunxi.core.util.BeanTools;
import com.yunxi.model.sto.StoStockIn;
import com.yunxi.service.localService.sto.StoStockInService;
import com.yunxi.sto.pojo.StoStockInPlanResponseVO;
import com.yunxi.sto.pojo.StoStockInQueryVO;
import com.yunxi.sto.pojo.StoStockInVO;
import com.yunxi.sto.service.StoStockInDubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import java.lang.reflect.InvocationTargetException;

/**
 * <p>
 * 车辆入库单 服务实现类
 * </p>
 *
 * @author caoYong
 * @since 2019-05-20
 */
public class StoStockInDubboServiceImpl implements StoStockInDubboService {

    @Autowired
    @Qualifier(value = "stoStockInServiceImpl")
    StoStockInService stoStockInService;


    @Override
    public StoStockInVO getById(String id) throws InvocationTargetException, IllegalAccessException {
        StoStockIn stoStockIn = stoStockInService.getById(id);
        StoStockInVO stoStockInVO = new StoStockInVO();
        BeanTools.copyProperties(stoStockInVO,stoStockIn);
        return stoStockInVO;
    }

    @Override
    public void saveOrUpdate(StoStockInVO stoStockInVO) throws InvocationTargetException, IllegalAccessException {
        StoStockIn stoStockIn = new StoStockIn();
        BeanTools.copyProperties(stoStockIn,stoStockInVO);
        stoStockInService.saveOrUpdate(stoStockIn);
    }

    @Override
    public void removeById(String id) {
    stoStockInService.removeById(id);
    }

    @Override
    public PageInfo<StoStockInPlanResponseVO> findPageByVO(StoStockInQueryVO stoStockInQueryVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
        PageInfo<StoStockInPlanResponseVO> pageInfo = stoStockInService.pageByVo(stoStockInQueryVO, pageNum, pageSize);
        return pageInfo;
    }

}
